home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / fm2_248.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1996-07-15  |  48KB  |  1,186 lines

  1. /****************************************************************************
  2.  * FM/2 2.x installation program copyright (c) 1993-96 by M. Kimes          *
  3.  ****************************************************************************
  4.  *                                                                          *
  5.  * This program creates folders to hold program and data objects,           *
  6.  * then creates program objects for each executable.  It only needs to be   *
  7.  * run once (unless you move the FM/2 directory -- see say notes at end).   *
  8.  * Run this program in the FM/2 directory (where you unpacked the archive). *
  9.  *                                                                          *
  10.  ****************************************************************************
  11.  *                                                                          *
  12.  * For unattended installation, call with /UNATTENDED as the first          *
  13.  * argument.  To avoid any WPS associations being set, use the              *
  14.  * /NOASSOC argument.  INSTALL /? for usage help.                           *
  15.  *                                                                          *
  16.  ****************************************************************************/
  17.  
  18. /* Identify ourself */
  19.  
  20. '@Echo off'
  21. 'cls'
  22.  
  23. say'     ┌───────────────────────────────────────────────────────────────────┐'
  24. say'     │                  FM/2 2.x Installation Program                    │'
  25. say'     │             FM/2 is copyright (c) 1993-96 by M. Kimes             │'
  26. say'     │                       All rights reserved                         │'
  27. say'     ├───────────────────────────────────────────────────────────────────┤'
  28. say'     ├───────────────────────────────────────────────────────────────────┤'
  29. say'     │                Have you read the READ.ME file yet?                │'
  30. say'     │        By running this program, you agree to the license          │'
  31. say'     │                     as specified in that file,                    │'
  32. say'     │      and it tells you how to install, so you should read it.      │'
  33. say'     │                             Please?                               │'
  34. say'     └───────────────────────────────────────────────────────────────────┘'
  35.  
  36. assocfilter = ';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0,READ.ME,README,README.1ST,README.OS2,REGISTER.TXT'
  37.  
  38. /* check arguments and adjust as required */
  39.  
  40. parse upper arg dummy1 dummy2
  41. if dummy1 = '/NOASSOC' then assocfilter = ''
  42. if dummy2 = '/NOASSOC' then assocfilter = ''
  43. if assocfilter = '' then say '     /NOASSOC = TRUE'
  44.  
  45. if dummy1 = '/UNATTENDED' then unattended = ''
  46. if dummy2 = '/UNATTENDED' then unattended = ''
  47. if unattended = '' then say '     /UNATTENDED = TRUE'
  48.  
  49. /* if user asked for usage help, give it */
  50.  
  51. if dummy1 = '/?' | dummy2 = '/?' then
  52. do
  53.   say ''
  54.   say 'Usage:  INSTALL [/NOASSOC] [/UNATTENDED]'
  55.   say ' /NOASSOC    = don''t set any WPS associations'
  56.   say ' /UNATTENDED = don''t ask any questions'
  57.   say ''
  58.   say 'Examples:'
  59.   say ' INSTALL'
  60.   say ' INSTALL /NOASSOC'
  61.   say ' INSTALL /UNATTENDED'
  62.   say ' INSTALL /NOASSOC /UNATTENDED'
  63.   exit
  64. end
  65.  
  66. /* see if we might be in the right directory... */
  67.  
  68. rc = stream('fm3.exe','c','query exists')
  69. if rc = '' then
  70. do
  71.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  72.   exit
  73. end
  74.  
  75. /* tell user what we're doing */
  76.  
  77. say ''
  78. say 'This program creates objects for FM/2 and does some drudgework for you.'
  79. say ''
  80.  
  81. /* load rexx utility functions */
  82.  
  83. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  84. call SysLoadFuncs
  85.  
  86. /* give user a chance to hit CTRL-C */
  87.  
  88. if unattended = 'UNATTENDED' then
  89. do
  90.   call charout ,'  Press [Enter] to continue...'
  91.   dummy = ''
  92.   do until dummy = '0d'x
  93.     dummy = SysGetKey('NOECHO')
  94.   end
  95.   call charout ,'0d1b'x'[K'
  96. end
  97.  
  98. /* save current directory */
  99.  
  100. curdir = directory()
  101.  
  102. /* say it, then do it */
  103.  
  104. say "Creating File Manager/2 folders and objects..."
  105.  
  106. /* first, create FM/2 folder */
  107.  
  108. rc = stream('fm2fldr.ico','c','query exists')
  109. title = "File Manager/2"
  110. classname = 'WPFolder'
  111. location = '<WP_DESKTOP>'
  112. setup = 'OBJECTID=<FM3_Folder>;OPEN=DEFAULT'
  113. if rc \= '' then setup = setup';ICONFILE='rc
  114. result = SysCreateObject(classname,title,location,setup,f)
  115.  
  116. if unattended = 'UNATTENDED' then
  117. do
  118.   if result = 0 then
  119.   do
  120.     assocfilter = ''
  121.     existed = ''
  122.     say ''
  123.     say 'The File Manager/2 folder already exists.'
  124.     call charout ,"Should I update the objects (it's painless)? (Y/N) "
  125.     dummy = ''
  126.     do forever
  127.       dummy = SysGetKey('NOECHO')
  128.       parse upper var dummy dummy
  129.       if dummy = '1b'x then dummy = 'N'
  130.       if dummy = '0d'x then dummy = 'Y'
  131.       if dummy = 'N' then leave
  132.       if dummy = 'Y' then leave
  133.     end
  134.     call charout ,dummy
  135.     say ''
  136.     if dummy = 'N' then exit
  137.   end
  138. end
  139. else
  140. do
  141.   if result = 0 then
  142.   do
  143.     assocfilter = ''
  144.     existed = ''
  145.     say 'Updating objects.'
  146.   end
  147. end
  148.  
  149. /* create objects in appropriate folders */
  150.  
  151. rc = stream('fm3.exe','c','query exists')
  152. if rc \= '' then
  153. do
  154.   title = "FM/2"
  155.   classname = 'WPProgram'
  156.   location = '<FM3_Folder>'
  157.   setup = 'OBJECTID=<FM/2>;EXENAME='rc';STARTUPDIR='curdir
  158.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  159.   call SysCreateObject classname,title,location,setup,u
  160. end
  161.  
  162. rc = stream('fm4.exe','c','query exists')
  163. if rc \= '' then
  164. do
  165.   title = "FM/2 Lite"
  166.   classname = 'WPProgram'
  167.   location = '<FM3_Folder>'
  168.   setup = 'OBJECTID=<FM/2 LITE>;EXENAME='rc';STARTUPDIR='curdir
  169.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  170.   call SysCreateObject classname,title,location,setup,u
  171. end
  172.  
  173. /* create toolbox folder in FM/2 folder */
  174. rc = stream('toolbox.ico','c','query exists')
  175. title = "FM/2 Tools"
  176. classname = 'WPFolder'
  177. location = '<FM3_Folder>'
  178. setup = 'OBJECTID=<FM3_Tools>;OPEN=DEFAULT'
  179. if rc \= '' then setup = setup';ICONFILE='rc
  180. result = SysCreateObject(classname,title,location,setup,u)
  181.  
  182. rc = stream('av2.exe','c','query exists')
  183. if rc \= '' then
  184. do
  185.   title = "Archive Viewer/2"
  186.   classname = 'WPProgram'
  187.   location = '<FM3_Tools>'
  188.   setup = 'OBJECTID=<FM/2_AV/2>;EXENAME='rc';STARTUPDIR='curdir''assocfilter
  189.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  190.   call SysCreateObject classname,title,location,setup,u
  191. end
  192.  
  193. rc = stream('eas.exe','c','query exists')
  194. if rc \= '' then
  195. do
  196.   title = "EA Viewer"
  197.   classname = 'WPProgram'
  198.   location = '<FM3_Tools>'
  199.   setup = 'OBJECTID=<FM/2_EAVIEW>;EXENAME='rc';STARTUPDIR='curdir
  200.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  201.   call SysCreateObject classname,title,location,setup,u
  202. end
  203.  
  204. rc = stream('dirsize.exe','c','query exists')
  205. if rc \= '' then
  206. do
  207.   title = "Dir Sizes"
  208.   classname = 'WPProgram'
  209.   location = '<FM3_Tools>'
  210.   setup = 'OBJECTID=<FM/2_DIRSIZE>;EXENAME='rc';STARTUPDIR='curdir
  211.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  212.   call SysCreateObject classname,title,location,setup,u
  213. end
  214.  
  215. rc = stream('makearc.exe','c','query exists')
  216. if rc \= '' then
  217. do
  218.   title = "Make Archive"
  219.   classname = 'WPProgram'
  220.   location = '<FM3_Tools>'
  221.   setup = 'OBJECTID=<FM/2_MAKEARC>;EXENAME='rc';STARTUPDIR='curdir
  222.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  223.   call SysCreateObject classname,title,location,setup,u
  224. end
  225.  
  226. rc = stream('ini.exe','c','query exists')
  227. if rc \= '' then
  228. do
  229.   if assocfilter \= '' then assocfilter = ';ASSOCFILTER=*.INI'
  230.   title = "INI Viewer"
  231.   classname = 'WPProgram'
  232.   location = '<FM3_Tools>'
  233.   setup = 'OBJECTID=<FM/2_INIVIEW>;EXENAME='rc';STARTUPDIR='curdir''assocfilter
  234.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  235.   call SysCreateObject classname,title,location,setup,u
  236. end
  237.  
  238. rc = stream('viewinfs.exe','c','query exists')
  239. if rc \= '' then
  240. do
  241.   title = "Bookshelf Viewer"
  242.   classname = 'WPProgram'
  243.   location = '<FM3_Tools>'
  244.   setup = 'OBJECTID=<FM/2_BOOKSHELF>;EXENAME='rc';STARTUPDIR='curdir
  245.   call SysCreateObject classname,title,location,setup,u
  246.   title = "Helpfile Viewer"
  247.   classna